<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <link rel="stylesheet" href="../userxiansuo/css/cssreset.css">
        <link rel="stylesheet" href="../userxiansuo/css/style.css">
        <link rel="stylesheet" href="../userxiansuo/css/style2.css">
        <script src="${pageContext.request.contextPath}/userxiansuo/css/pagination.css"></script>
        
    <style>
    	label.error{
       font-size:13px; 
		margin-left:8px;
		color: orangered;
        }
    
    </style>
         
       
    </head>
    <body>
    	<div class="bigbox xlbox">
    		<nav class="daohan">
                <span class="scolor"></span>
                <ul>
                    <li class="sh1">
                        <a href="<%=basePath %>notice/findByAll.action" ><p class="mline"><span class="smallicon" id="current1111"></span><span class="navtxt">首页</span></p></a>
                        
                    </li>
                    <li class="sh1">
                        <a href="<%=basePath %>client/qiangenzongcount.action?zhuizong=0"><p class="mline"><span class="smallicon" id="current11"></span><span class="navtxt">用户开发</span><span class="ripic"></span></p></a>
                        <div class="showhide1"> 
	                        <a href="<%=basePath %>client/selectDepOrSta.action" style="font-size:14px;background:#435565;">
		                        <p class="mline">
		                             <span class="smallicon" id="ziji11"></span>
		                             <span class="navtxt" id="current2" style="	font-size: 14px;color:#929da8;">个人客户</span>
		                        </p>
                            	</a>

                             <a href="<%=basePath %>client/selectDepOrSta.action?start=1" style="font-size:14px;background:#435565;">
                             <p class="mline">
                             	<span class="smallicon" id="ziji2"></span>
                             	<span class="navtxt" id="current2" style="font-size: 14px;color:#929da8;">企业客户</span>
                             </p>
                             </a>   
                        </div>
                    </li>
                    <li class="sh2">
                        <a href="${pageContext.request.contextPath}/Usertracking/count1.action" id="sline"><p class="mline"><span class="smallicon one111"></span><span class="navtxt"  id="current2">客户信息</span><span class="ripic"></span></p></a>
                        <div class="showhide2">
                        	<a href="${pageContext.request.contextPath}/Usertracking/count.action" id="sline1"">
                                <p class="mline">
                                     <span class="smallicon" id="ziji43"></span>
                                     <span class="navtxt" id="current2" style=" font-size: 14px;">个人信息</span>
                                </p>
                            </a>  

                             <a href="${pageContext.request.contextPath}/Usertracking/count1.action" style="font-size:14px;background:#435565;">
                             <p class="mline">
                             	<span class="smallicon" id="ziji4"></span>
                             	<span class="navtxt" id="current2" style="font-size: 14px;color:#929da8;">企业信息</span>
                             </p>
                             </a>    
                        </div>
                        </li>
                    <li class="sh3">
                        <a href="../approve/count.action?pageSize=0"><p class="mline"><span class="smallicon one2"></span><span class="navtxt">合同审批</span><span class="ripic"></span></p></a>
                        <div class="showhide3">
                        	<a href="../page/pacts.jsp" style="font-size:14px;background:#435565;">
                             <p class="mline tiao">
                             	<span class="smallicon" id="ziji3"></span>
                             	<span class="navtxt" id="current2" style="font-size: 14px;color:#929da8;">合同审批表</span>
                             </p>
                             </a> 

                             <a href="../pages/audits.jsp" style="font-size:14px;background:#435565;">
                             <p class="mline tiao">
                             	<span class="smallicon" id="ziji4"></span>
                             	<span class="navtxt" id="current2" style="font-size: 14px;color:#929da8;">合同审核表</span>
                             </p>
                             </a>    
                        </div>
                    </li>
                    <li class="sh4">
                        <a href="#"><p class="mline"><span class="smallicon one3"></span><span class="navtxt">资料共享</span></p></a>

                    </li>
                </ul>
            </nav>
            
    		<div class="showbox">
                <h2>客 户 信 息</h2>
                <div class="showbox2">
	    		
	    			<div class="aaa">
		    			<div class="smalltitle">
		 					
							<a href="#" class="light3">
								<span class="imgmove imgmove2 khicon">
								
								</span>&nbsp;&nbsp;新建客户信息
							</a>
							<form action="${pageContext.request.contextPath}/Usertracking/count.action" method="post" onsubmit="return selectBy()" style="display: inline-block;">
							<span class="yezi3">
		 						<input type="text" id="selectBy" name="select" placeholder="&nbsp;&nbsp;&nbsp;&nbsp;请输入客户姓名" style="color:#bfbfbf;font-size:12px;border-radius: 16px;outline:none;border:1px solid #e7e7e8;height:36px;width:200px;font-size: 14px;padding-left: 10px;">
		 						<input type="submit" value="搜 索" style="height:36px;width:70px;border-radius: 16px;outline:none;border:none;background:#1fd4fb;color:#fff;margin-left:10px;">
		 					</span>
		 					</form>
		 					<p class="yezi">
								<a href="#" onclick="daoru()">
								<span class="imgmove imgmove2 kdaoru">
								
								</span>&nbsp;&nbsp;导入</a>
								<a href="#"><span class="imgmove imgmove2 kdaochu">
								</span>&nbsp;&nbsp;导出</a>
							 </p>
							 
		    			</div>
	    				
	    				<div class="apprcontent">
	    				<%-- <c:forEach items="${list}" var="list" varStatus="status">
    						<div class="content" id="${status.index+1}">
    									<h6 class="sbox1">
    									<input type="hidden" value="${list.usertracking.id}"/>
    									<span name="span1" class="names">客户姓名：<span class="kone">${list.usertracking.clientName}</span></span>
    									<span name="span2" class="kkinds">级别：<span class="ktwo">${list.rank}</span></span>
    									<span name="span3" class="qj">事件类型：<span class="kthree">${list.record}</span></span>
    									<span name="span4" class="date">提交日期：<span class="kfour"><fmt:formatDate value='${list.usertracking.createDate}' pattern='yy-MM-dd hh:mm:ss'/></span></span>
										
    									<span class="delwrite">
    										<a href="#" class="fish" id="${status.index+1}" onclick="bianji(this,${list.usertracking.id})">编辑</a>
    										<a href="#" onclick="del(${list.usertracking.id})">删除</a>
    									</span>
    										
    									
    									</h6>
    									<h5 class="ssbox1">
    										正文：<span>${list.usertracking.information}</span>
    										<strong class="zhengwen" style="padding-right: 30px;">${list.usertracking.information}</strong>
    									</h5><a href="#" class="more">查看更多 > </a>
    						</div>
    						</c:forEach> --%>			
    					</div>			
    				</div>
    				
	    			</div>
	    			<div id="cover4">
						<div id="cover-bg3"></div>
						<div id="haappy">
							<h4>新 建 客 户 信 息<span class="close"></span></h4>
							<form method="post" id="insertform">
							<p class="main" style="margin-top:20px;padding-right: 0px;">
								<span class="leftmain">客 户 姓 名</span>
								<input type="text" placeholder="&nbsp;&nbsp;请输入客户名称 " name="clientName" id="clientName" class="shurukuang" style="margin-left: 25px;">
							</p>
							<input type="hidden" class="name" id="staffId" name="staffId"
									value="${staff.staff_id}">
							<p class="main" style="padding-right: 0px;">
								<span class="leftmain">级 别&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
								<select id="jibie" class="shenfenselect shenfenselect3" name="rankId" style="margin-left: 25px;">
								<c:forEach var="rank" items="${rank}">
									<option value="${rank.rankId}">${rank.rankName}</option>
								</c:forEach>
								 </select>
							</p>
							
							<p class="main" style="padding-right: 0px;">
								<span class="leftmain">事件类型&nbsp;&nbsp;&nbsp;</span>
								<select id="leixing" class="shenfenselect shenfenselect3" name="recordId" style="margin-left: 25px;">
								<c:forEach var="records" items="${records}">
									<option value="${records.recordId}">${records.recordName}</option>
								</c:forEach>
								 </select>
							</p>
							
							<p class="main" style="height:100px;padding-right: 0px;">
								<span class="leftmain" style="position:absolute;">信息跟踪：</span>
								<textarea name="information" id="information" class="shurukuang" style="height:100px;margin-left: 22%;"></textarea>
							</p>
							
							<p class="main" style="text-align:center;margin-top:15px;">
								<button class="btn1 btn2" type="submit">保存</button>
								<button class="btn1 btn3">取消</button>
							</p>
							</form>
						</div>
					 </div>
					 <div id="cover3">
						<div id="cover-bg3"></div>
						<div id="haappy2">
							<form method="post" id="formbianji">
							<h4>编 辑 客 户 信 息<span class="close"></span></h4>
							<p class="main" style="margin-top:20px;padding-right: 0px;">
								<span class="leftmain">客 户 姓 名</span>
								<input type="text" placeholder="&nbsp;&nbsp;请输入客户名称 " class="shurukuang" style="margin-left: 25px;padding-left: 5px;" name="clientName" id="clientName1">
							</p>
							<input type="hidden" class="name" id="userttackid" name="userttackid">
							<input type="hidden" class="name" id="staffId1" name="staffId"
									value="${staff.staff_id}">
							<p class="main" style="padding-right: 0px;">
								<span class="leftmain">级 别&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
								<select id="jibie1" class="shenfenselect shenfenselect3" name="rankId" style="margin-left: 25px;">
								<c:forEach var="rank" items="${rank}">
									<option value="${rank.rankId}">${rank.rankName}</option>
								</c:forEach>
								 </select>
							</p>
							
							<p class="main" style="padding-right: 0px;">
								<span class="leftmain">事件类型&nbsp;&nbsp;&nbsp;</span>
								<select id="leixing1" class="shenfenselect shenfenselect3" name="recordId" style="margin-left: 25px;">
								<c:forEach var="records" items="${records}">
									<option value="${records.recordId}">${records.recordName}</option>
								</c:forEach>
								 </select>
							</p>
							<p class="main" style="height:100px;padding-right: 0px;">
								<span class="leftmain" style="position:absolute;">正 文</span>
								<textarea name="information" id="information1" class="shurukuang" style="height:100px;margin-left: 22%;padding-left: 5px;"></textarea>
							</p>
							
							<p class="main" style="text-align:center;margin-top:15px;">
								<button class="btn1 btn2" type="submit">编辑</button>
								<button class="btn1 btn3">取消</button>
							</p>
							</form>
						</div>
					 </div>
					 		
	    		</div>
	    	<div class="dao" id="motai">
            	<p>导入数据<img src="../images/guanbi.png" class="guanbi"/></p >
	            <div>
	                <p>仅支持以逗号为分隔符的文本文件【filename.csv】,文件最大10MB。请按照数据模板的格式导入数据,模板中的表头名称不可更改,表头行不能删除。</p >
	                <p><a href="">下载数据模板</a></p >
	                <form id="upload-form" action="javascript:excilClient()" method="post" onsubmit="return fileSelect()" enctype="multipart/form-data" >
		                　　		<div>
		                        <p>请选择需要导入的csv文件</p >
		                        <p><input type="file" name="file" id="filea"/></p >
		                </div>
	                    <p>上传文件可能需要几分钟，取决于文件大小和网速</p >
	                　　			<p><input type="button" value='取消' class="buts"><input type="button" onclick="UpladFile()" value="导入" /></p >
                	</form>
            	</div>
        	</div>
	    	<div class="M-box"></div>
        </div>
    	<div id="" class="bg">
    		
    	</div>  
    	
    </body>
    <script src="../userxiansuo/js/jquery-1.8.3.min.js"></script>
    <script
		src="${pageContext.request.contextPath}/salejihui/My97DatePicker/WdatePicker.js"></script>
	<script
		src="${pageContext.request.contextPath}/salejihui/js/jquery.validate.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/salejihui/js/messages_zh.min.js"></script>
	<script
		src="${pageContext.request.contextPath}/salejihui/js/jquery.pagination.js"></script>
	
	    <script type="text/javascript">
	    $('.guanbi').click(function(event){
	    		$('.dao').css('display','none');
	    		$('.bg').css('display','none');
	    	})
	    $('.buts').click(function(event){
	    	$('.dao').css('display','none');
    		$('.bg').css('display','none');
	    })
	    
		    $('.M-box').pagination({
		    	pageCount: ${PageCount},//总页数
				current: ${PageNum},//当前页码
			callback:function(api){
				var pageNum=api.getCurrent();
				var selectd="${select}";
		        $.ajax({  
		            type : "POST",  
		            url : "${pageContext.request.contextPath}/Usertracking/findUsertracking.action",//路径  
		            data : {  
		            	pageNum : api.getCurrent(),
		            	  select : selectd,
		            	  statu:0 
		            },
		            success : function(data) {
		            	var number=data[0].number;//总页数
		            	api.setPageCount(number);//动态修改总页数为20页
		            	var pageNum=data[0].pageNum;
		            	var text="";
		            	$('.content').remove();
                      for(var i=0;i<data[0].list.length;i++){
                           
                            text=$("<div class='content'><h6 class='sbox1'><input type='hidden' value='"+data[0].list[i].usertracking.id+"'/><span name='span1' class='names'>客户姓名：<span class='kone'>"+data[0].list[i].usertracking.clientName+"</span>"
                            		+"</span><span name='span2' class='kkinds'>级别：<span class='ktwo'>"+data[0].list[i].rank+"</span></span><span name='span3' class='qj'>事件类型：<span class='kthree'>"+data[0].list[i].record+"</span>"
                            		+"</span><span name='span4' class='date'>提交日期：<span class='kfour'>"+data[0].list[i].shijian+"</span></span>"
    								+"<span class='delwrite'><a href='#' class='fish' onclick='bianji(this,"+data[0].list[i].usertracking.id+")'>编辑</a><a href='#' onclick='del("+data[0].list[i].usertracking.id+")'>删除</a></span></h6>"	
									+"<h5 class='ssbox1'>正文：<span>"+data[0].list[i].usertracking.information+"</span><strong class='zhengwen' style='padding-right: 30px;'>"+data[0].list[i].usertracking.information+"</strong></h5><a href='#' class='more'>查看更多 ></a>");
                            $('.apprcontent').append(text);
                          }
                      $(".content").each(function(){
            	$(".content:odd").css("background","#fff");
            })
            //判断字符是否超标，超标用....显示
            /*$(".more").hide();*/
            $("strong[class=zhengwen]").hide();
            $(".ssbox1").each(function(){
				var maxwidth=20;
				if($(this).find("span").html().length>maxwidth){
				$(this).find("span").html($(this).find("span").html().substring(0,maxwidth)+'...');
				$(this).next().show();
				}
			});
            $("a[class=more]").toggle(function(){
            	$(this).prev().find("strong[class=zhengwen]").show();
            	$(this).prev().find("span").hide();
            	$(this).html("收起");
            },function(){
            	$(this).prev().find("strong[class=zhengwen]").hide();
            	$(this).prev().find("span").show();
            	$(this).html("查看更多");
            })
            
            
            $(".light3").click(function(e){
			    	$('body').css("overflow","hidden")
			        e.preventDefault();
			        $("#cover4").css("display","block");
			        $("#cover4").animate({
			            width: "100%",
			            height: "1800px",
			            top: "0",
			            left: "0"
			        },10);
			        });
			        $(".fish").click(function(e){
			        $('body').css("overflow","hidden")
			        e.preventDefault();
			        $("#cover3").css("display","block");
			        $("#cover3").animate({
			            width: "100%",
			            height: "1800px",
			            top: "0",
			            left: "0"
			        },10);
			        });
            	$("#formbianji").validate({
							onsubmit : true,// 是否在提交是验证  
							onblur : true,// 是否在获取焦点时验证  
							onkeyup : false,// 是否在敲击键盘时验证  

							rules : {
								clientName : {
									required : true
								},
								recordId : {
									required : true
								},
								information : {
									required : true
								}
							},
							messages : {
								clientName : {
									required : "客户姓名不能为空"
								},
								recordId : {
									required : "客户等级不能为空"
								},
								information : {
									required : "信息描述不能为空"
								},
							},
							submitHandler : function(form) { //通过之后回调  
								var jibie = $("#jibie1").find("option:selected")
										.attr("value");
								var jilu = $("#leixing1").find("option:selected")
										.attr("value");
								var status = 0;
								var url = "${pageContext.request.contextPath}/Usertracking/updateUsertracking.action";
								var pam = {
									clientName : $("#clientName1").val(),
									recordId : jilu,
									rankId : jibie,
									information : $("#information1").val(),
									statu : status,
									staffId : $("#staffId1").val(),
										id :$("#userttackid").val()
								};

								$.post(
												url,
												pam,
												function(data) {
							
													if (data == "编辑成功") {
														alert(data);
														location = "${pageContext.request.contextPath}/Usertracking/count.action";
													} else {
														alert("修改失败，页面发生错误");
													}

												});
							},
							invalidHandler : function(form, validator) { //不通过回调  
								return false;
							}
						});
            	
            
            /* jQuery.validator.addMethod("stringCheck", function(value, element) {
		 var length = value.length;  
		var regName = /[^\u4e00-\u9fa5]/g;  
		return this.optional(element) || !regName.test( value ); 
		}, "机会名称为中文");  */
		 $("#insertform").validate({
							onsubmit : true,// 是否在提交是验证  
							onblur : true,// 是否在获取焦点时验证  
							onkeyup : false,// 是否在敲击键盘时验证  

							rules : {
								clientName : {
									required : true
								},
								recordId : {
									required : true
								},
								information : {
									required : true
								}
							},
							messages : {
								clientName : {
									required : "客户姓名不能为空"
								},
								recordId : {
									required : "客户等级不能为空"
								},
								information : {
									required : "信息描述不能为空"
								},
							},
							submitHandler : function(form) { //通过之后回调  
								var jibie = $("#jibie").find("option:selected")
										.attr("value");
								var jilu = $("#leixing").find("option:selected")
										.attr("value");
								var status = 0;
								var url = "${pageContext.request.contextPath}/Usertracking/insertUsertracking.action";
								var pam = {
									clientName : $("#clientName").val(),
									recordId : jilu,
									rankId : jibie,
									information : $("#information").val(),
									statu : status,
									staffId : $("#staffId").val()
								};

								$.post(
												url,
												pam,
												function(data) {
													if (data == "success") {
														alert("新增成功");
														location = "${pageContext.request.contextPath}/Usertracking/count.action";
													} else {
														alert("新增失败，页面发生错误");
													}

												});
							},
							invalidHandler : function(form, validator) { //不通过回调  
								return false;
							}
						}); 
            
            
            
            
            	/*$('.more').click(function(event) {
            		$('.ssbox1').css({
            			'text-overflow': 'normal',
            			'overflow': 'normal',
            			'white-space':'normal'
            		});
            		$(this).css('display', 'none');
            	});*/
            	
            	
			        
			    

			    $(".close").click(function(){
			    	$('body').css("overflow","scroll")
			        $("#cover4").removeAttr("style");
			        $("#cover-content3").removeAttr("style");
			        $('body').remove("label.error");
			    });
			   
			   

			    $(".close").click(function(){
			    	$('body').css("overflow","scroll")
			        $("#cover3").removeAttr("style");
			        $("#haappy2").removeAttr("style");
			        $('body').remove("label.error");
			    });
			   

			    
                $('.sh1').mouseover(function(event) {
                    $('.showhide1').css('display', 'block');
                });
                $('.sh1').mouseout(function(event) {
                    $('.showhide1').css('display', 'none');
                });
                $('.sh2').mouseover(function(event) {
                    $('.showhide2').css('display', 'block');
                });
                $('.sh2').mouseout(function(event) {
                    $('.showhide2').css('display', 'none');
                });
                $('.sh3').mouseover(function(event) {
                    $('.showhide3').css('display', 'block');
                });
                $('.sh3').mouseout(function(event) {
                    $('.showhide3').css('display', 'none');
                });
		            }
		        });  
		    }
		},function(api){
		    var pageNum;
		    var selectd="${select}";
		    $.ajax({  
		        type : "POST",  
		        url : "${pageContext.request.contextPath}/Usertracking/findUsertracking.action",//路径  
		        data : {  
		        	pageNum : api.getCurrent(),
		        	select  : selectd,
		        	statu:0
		        },
		        success : function(data) {		     
		        	var number=data[0].number;//总页数
		        	api.setPageCount(number);//动态修改总页数为20页
		        	var pageNum=data[0].pageNum;
		        	var text="";  
                    for(var i=0;i<data[0].list.length;i++){
                            text=$("<div class='content'><h6 class='sbox1'><input type='hidden' value='"+data[0].list[i].usertracking.id+"'/><span name='span1' class='names'>客户姓名：<span class='kone'>"+data[0].list[i].usertracking.clientName+"</span>"
                            		+"</span><span name='span2' class='kkinds'>级别：<span class='ktwo'>"+data[0].list[i].rank+"</span></span><span name='span3' class='qj'>事件类型：<span class='kthree'>"+data[0].list[i].record+"</span>"
                            		+"</span><span name='span4' class='date'>提交日期：<span class='kfour'>"+data[0].list[i].shijian+"</span></span>"
    								+"<span class='delwrite'><a href='#' class='fish' onclick='bianji(this,"+data[0].list[i].usertracking.id+")'>编辑</a><a href='#' onclick='del("+data[0].list[i].usertracking.id+")'>删除</a></span></h6>"	
									+"<h5 class='ssbox1'>正文：<span>"+data[0].list[i].usertracking.information+"</span><strong class='zhengwen' style='padding-right: 30px;'>"+data[0].list[i].usertracking.information+"</strong></h5><a href='#' class='more'>查看更多 ></a>");
                            $('.apprcontent').append(text);
                            
                          }   
                          $(".content").each(function(){
            	$(".content:odd").css("background","#fff");
            })
            //判断字符是否超标，超标用....显示
            /*$(".more").hide();*/
            $("strong[class=zhengwen]").hide();
            $(".ssbox1").each(function(){
				var maxwidth=20;
				if($(this).find("span").html().length>maxwidth){
				$(this).find("span").html($(this).find("span").html().substring(0,maxwidth)+'...');
				$(this).next().show();
				}
			});
            $("a[class=more]").toggle(function(){
            	$(this).prev().find("strong[class=zhengwen]").show();
            	$(this).prev().find("span").hide();
            	$(this).html("收起");
            },function(){
            	$(this).prev().find("strong[class=zhengwen]").hide();
            	$(this).prev().find("span").show();
            	$(this).html("查看更多");
            })
            
            
            $(".light3").click(function(e){
			    	$('body').css("overflow","hidden")
			        e.preventDefault();
			        $("#cover4").css("display","block");
			        $("#cover4").animate({
			            width: "100%",
			            height: "1800px",
			            top: "0",
			            left: "0"
			        },10);
			        });
			        $(".fish").click(function(e){
			        $('body').css("overflow","hidden")
			        e.preventDefault();
			        $("#cover3").css("display","block");
			        $("#cover3").animate({
			            width: "100%",
			            height: "1800px",
			            top: "0",
			            left: "0"
			        },10);
			        });
            	$("#formbianji").validate({
							onsubmit : true,// 是否在提交是验证  
							onblur : true,// 是否在获取焦点时验证  
							onkeyup : false,// 是否在敲击键盘时验证  

							rules : {
								clientName : {
									required : true
								},
								recordId : {
									required : true
								},
								information : {
									required : true
								}
							},
							messages : {
								clientName : {
									required : "客户姓名不能为空"
								},
								recordId : {
									required : "客户等级不能为空"
								},
								information : {
									required : "信息描述不能为空"
								},
							},
							submitHandler : function(form) { //通过之后回调  
								var jibie = $("#jibie1").find("option:selected")
										.attr("value");
								var jilu = $("#leixing1").find("option:selected")
										.attr("value");
								var status = 0;
								var url = "${pageContext.request.contextPath}/Usertracking/updateUsertracking.action";
								var pam = {
									clientName : $("#clientName1").val(),
									recordId : jilu,
									rankId : jibie,
									information : $("#information1").val(),
									statu : status,
									staffId : $("#staffId1").val(),
										id :$("#userttackid").val()
								};

								$.post(
												url,
												pam,
												function(data) {
							
													if (data == "编辑成功") {
														alert(data);
														location = "${pageContext.request.contextPath}/Usertracking/count.action";
													} else {
														alert("修改失败，页面发生错误");
													}

												});
							},
							invalidHandler : function(form, validator) { //不通过回调  
								return false;
							}
						});
            	
            
            /* jQuery.validator.addMethod("stringCheck", function(value, element) {
		 var length = value.length;  
		var regName = /[^\u4e00-\u9fa5]/g;  
		return this.optional(element) || !regName.test( value ); 
		}, "机会名称为中文");  */
		 $("#insertform").validate({
							onsubmit : true,// 是否在提交是验证  
							onblur : true,// 是否在获取焦点时验证  
							onkeyup : false,// 是否在敲击键盘时验证  

							rules : {
								clientName : {
									required : true
								},
								recordId : {
									required : true
								},
								information : {
									required : true
								}
							},
							messages : {
								clientName : {
									required : "客户姓名不能为空"
								},
								recordId : {
									required : "客户等级不能为空"
								},
								information : {
									required : "信息描述不能为空"
								},
							},
							submitHandler : function(form) { //通过之后回调  
								var jibie = $("#jibie").find("option:selected")
										.attr("value");
								var jilu = $("#leixing").find("option:selected")
										.attr("value");
								var status = 0;
								var url = "${pageContext.request.contextPath}/Usertracking/insertUsertracking.action";
								var pam = {
									clientName : $("#clientName").val(),
									recordId : jilu,
									rankId : jibie,
									information : $("#information").val(),
									statu : status,
									staffId : $("#staffId").val()
								};

								$.post(
												url,
												pam,
												function(data) {
													if (data == "success") {
														alert("新增成功");
														location = "${pageContext.request.contextPath}/Usertracking/count.action";
													} else {
														alert("新增失败，页面发生错误");
													}

												});
							},
							invalidHandler : function(form, validator) { //不通过回调  
								return false;
							}
						}); 
            
            
            
            
            	/*$('.more').click(function(event) {
            		$('.ssbox1').css({
            			'text-overflow': 'normal',
            			'overflow': 'normal',
            			'white-space':'normal'
            		});
            		$(this).css('display', 'none');
            	});*/
            	
            	
			        
			    

			    $(".close").click(function(){
			    	$('body').css("overflow","scroll")
			        $("#cover4").removeAttr("style");
			        $("#cover-content3").removeAttr("style");
			        $('body').remove("label.error");
			    });
			   
			   

			    $(".close").click(function(){
			    	$('body').css("overflow","scroll")
			        $("#cover3").removeAttr("style");
			        $("#haappy2").removeAttr("style");
			        $('body').remove("label.error");
			    });
			   

			    
                $('.sh1').mouseover(function(event) {
                    $('.showhide1').css('display', 'block');
                });
                $('.sh1').mouseout(function(event) {
                    $('.showhide1').css('display', 'none');
                });
                $('.sh2').mouseover(function(event) {
                    $('.showhide2').css('display', 'block');
                });
                $('.sh2').mouseout(function(event) {
                    $('.showhide2').css('display', 'none');
                });
                $('.sh3').mouseover(function(event) {
                    $('.showhide3').css('display', 'block');
                });
                $('.sh3').mouseout(function(event) {
                    $('.showhide3').css('display', 'none');
                });
		        }
		    });  
		});
		
		
</script>	
		
    <script>
    	
    	function UpladFile() {
		   var fileObj = document.getElementById("filea").files[0]; // js 获取文件对象
		   var FileController = "../Usertracking/excelImportByuser.action";     // 接收上传文件的后台地址 
		   // FormData 对象
		   var form = new FormData();
		   form.append("author", "hooyes");      // 可以增加表单数据
		   form.append("file", fileObj);
		   form.append("statu", 0);
		   // 文件对象
		   // XMLHttpRequest 对象
		   var xhr = new XMLHttpRequest();
		   xhr.open("post", FileController, true);
		   xhr.onload = function (date) {
		   };
		   xhr.onreadystatechange=function(data){
		   		alert(data);
		   }
		   xhr.upload.addEventListener("progress", progressFunction, false);
		   xhr.send(form);
		  }
	 	  function progressFunction(evt) {
			   var progressBar = document.getElementByIdx_x_x("progressBar");
			   var percentageDiv = document.getElementByIdx_x_x("percentage");
			   if (evt.lengthComputable) {
			    progressBar.max = evt.total;
			    progressBar.value = evt.loaded;
			    percentageDiv.innerHTML = Math.round(evt.loaded / evt.total * 100) + "%";
			   }
		  }
    	
    	//导入,弹出模态框
    	function daoru(){
    		$("#motai").show();
    		$('.bg').css('display','block');
    	}
    	
    	//模糊查询判断为空
    	function selectBy(){
    	alert($("#selectBy").val());
    		var vals = $("#selectBy").val();
    		if(vals == ""){
    		alert("不能为空");
    			return false;
    		}else{
    		return true;
    		}
    	}
    	//编辑时获取值
    	function bianji(obj,uid){
		//获取表格中的一行数据  
		var name=$(obj).parent().parent().find("span[name=span1]").find("span").html();
		var jibiea=$(obj).parent().parent().find("span[name=span2]").find("span").html();
		var leixinga=$(obj).parent().parent().find("span[name=span3]").find("span").html();
		var info=$(obj).parent().parent().next().find("strong[class=zhengwen]").html();
		
		//向模态框中传值  
		$('#userttackid').val(uid);
		$('#clientName1').val(name);
		$('#information1').val(info);
		var options = $('#jibie1 > option');
				//options是集合，数组的意思,i指索引,option指当前的对象
				$.each(options,function(i,option){
					if(option.text ==jibiea )
					{
						option.selected= true;
					}
				});
		var optio = $('#leixing1 > option');
				//options是集合，数组的意思,i指索引,option指当前的对象
				$.each(options,function(i,option){
					if(option.text ==leixinga )
					{
						option.selected= true;
					}
				});	
    	}
    	
        	function del(uid) {
				  if(confirm("确定要删除吗?")){
				   var url = "${pageContext.request.contextPath}/Usertracking/deleteManyId.action";
				var stutas=0;
				var pam = {
					id : uid
				};
		
				$
				.post(
						url,
						pam,
						function(data) {
							if (data == "删除成功") {
								alert(data);
								location = "${pageContext.request.contextPath}/Usertracking/count.action";
							} else {
								alert(data);
							}

						});
				  }
				  else{
				   
				  }
	}

		
            
        </script>
</html>
